/**
 * MathUtils.java 12.10.2006
 */
package org.dicr.util.math;

/**
 * Mathematical utilities
 * 
 * @author <A href='http://dicr.org'>Igor A Tarasov</A>
 * @version 061012
 */
public class MathUtils {

	/**
     * Round value to rounder. The formula is: <CODE>Math.round(value / rounder) * rounder</CODE>. For example:
     * <CODE><PRE>
     * 
     * value = 0.1234 rounder = 0.01 result = 0.12;<BR>
     * value = 0.3456 rounder = 0.05 value = 0.35;
     * 
     * </PRE></CODE>
     * 
     * @param value value to round to
     * @param rounder rounder
     * @return value rounded to rounder
     */
	public static double roundTo(double value, double rounder) {
		return Math.round(value / rounder) * rounder;
	}
}
